package devicedbgui;
import java.io.File;
import java.io.FilenameFilter;
import java.lang.*;


public class delfile {

     public void deleteFiles( String d ) {

     ExtensionFilter filter = new ExtensionFilter(".ini");
     File dir = new File(d);

     String[] list = dir.list(filter);
     File file;
     if (list.length == 0) return;

     for (int i = 0; i < list.length; i++) {
       file = new File(d + "\\"+list[i]);
       boolean isdeleted =   file.delete();
       System.out.print(file);
       System.out.println( "  deleted " + isdeleted);
     }
   }

   class ExtensionFilter implements FilenameFilter {

     private String extension;

     public ExtensionFilter( String extension ) {
       this.extension = extension;             
     }
     public boolean accept(File dir, String name) {
       return (name.endsWith(extension));
     }
   }
}